package com.sbcb.http.filter;

import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class EncodeFilter extends OncePerRequestFilter {
    private String encoding = "UTF-8";

    @Override
    protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException {
        httpServletRequest.setCharacterEncoding(encoding);
        System.out.println("SBP-EncodeFilter");
        filterChain.doFilter(httpServletRequest, httpServletResponse);
    }
}
